package com.orcamento.dao;

import java.util.List;

import org.hibernate.criterion.Order;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.orcamento.entity.Category;

public class CategoryDao extends AbstractDao<Category> {

	public CategoryDao() {
		super(Category.class);
	}

	@Transactional(propagation=Propagation.REQUIRED)
	public Category save(Category category) {
		return super.saveEntity(category);
	}
	
	@Transactional(propagation=Propagation.REQUIRED)
	public void delete(Category entity) {
		super.delete(entity);
	}

	public List<Category> findAllByAccount(Long accountId) {
		return super.findAllByAccount(accountId, Order.asc("name"));
	}

	public Category findByIdAndAccount(Long id, Long accountId) {
		return super.findByIdAndAccount(id, accountId);
	}

}
